home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_13_07
/
ross
/
brute.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-05-31
|
365b
|
22 lines
#include <stdio.h>
int bfFind(int n, char *txt, int m, char *pat)
{
int i, j, k, lim;
int nmatch = 0;
lim = n - m + 1;
i = 0;
while (i<lim) {
k = i;
for (j=0; j<m && txt[k] == pat[j]; j++)
k++;
if (j == m) {
nmatch++;
printf("%d \n", i);
i += m;
}
else
i++;
}
return(nmatch);
}